#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

const int MAXN = 4 * 1e5;

int a[MAXN];

signed main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n;
    cin >> n;
    for(int i = 1; i <= n; ++ i)
        cin >> a[i];

    sort(a + 1, a + n + 1);

    a[0] = a[1];
    int last = 1, tot = 0, ans = 0;

    for(int i = 1; i <= n; ++ i){
        if(a[i] != a[i - 1]){
            tot += i - last;
            last = i;
        }
        if(tot > 0){
            ans++;
            tot --;
        }
    }

    cout << n - ans;
    return 0;
}